#include "plantplane1.h"
#include "config.h"
plantplane1::plantplane1() {
    //初始化加载飞机文件
    m_Plane.load(PLANT_PLANE);

    //初始化飞机坐标
        m_X=m_Plane.width()*0.5;
        m_Y=(GAME_HEIGHT-m_Plane.height())*0.5;
    //初始化矩形边框
        m_Rect.setWidth(m_Plane.width());
        m_Rect.setHeight(m_Plane.height());
        m_Rect.moveTo(m_X,m_Y);
        m_interval=BULLET1_INTERVAL;
        m_recorder=0;
        m_score=0;
        m_HP=1;

}


void plantplane1::shot()
{
    m_recorder++;

    if(m_recorder<m_interval){
        return;
    }

    m_recorder=0;

    for(int i=0;i<BULLET1_NUM;i++){

        if(m_bullet1s[i].m_Free){

        m_bullet1s[i].m_Free=false;

        m_bullet1s[i].m_X=m_X;

        m_bullet1s[i].m_Y=m_Y;

            break;
        }
    }

}



void plantplane1::setposition(int x,int y)
{
    m_X=x;
    m_Y=y;
    m_Rect.moveTo(m_X,m_Y);
}


